# # 斐波那契数列
# def fib(n):
#     if n < 2:
#         return n
#     else:
#         return fib(n - 2) + fib(n - 1)
#
#
# print(fib(6))
#
#
# # 快排
# def quick(qlist):
#     if len(qlist) == 0:
#         return qlist
#     else:
#         qb = qlist[0]
#         qa = quick([l for l in qlist[1:] if l <= qb])
#         qc = quick([r for r in qlist[1:] if r > qb])
#     return qa + [qb] + qc
#
#
# print(quick([23, 1, 25, 3562, 233, 622]))
#
#
# # 随机插入排序
# def insertQuick(qlist):
#     for i in range(1, len(qlist)):
#         key = qlist[i]
#         j = i - 1
#         while j >= 0 and key < qlist[j]:
#             qlist[j + 1] = qlist[j]
#             j -= 1
#             qlist[j + 1] = key
#     return qlist
#
#
# print(insertQuick([342, 2, 52535, 3, 21, 56]))
#
#
# # 99乘法表
#
# def n_n():
#     for i in range(1, 10):
#         for j in range(1, i + 1):
#             print(f'{j}*{i}={j * i} ', end=' ')
#         print('\t')
#
#
# print(n_n())
#
#
# # 统计字符串中出现次数最多的字符和次数
# def countStr():
#     s1 = 'djdfnssssnkvchweiuufhsjvs'
#     d1 = {}
#     for s in s1:
#         if s not in d1:
#             d1[s] = 1
#         else:
#             d1[s] += 1
#     for k, v in d1.items():
#         if v == max(d1.values()):
#             print(k, v)
#
#
# print(countStr())
#
#
# # Switch语句
# # sw = {"姓名": "周抗抗", "性别": "男", "年龄": 36}
# # userInput = input("请输入姓名/性别/年龄：\n")
# # print(sw[userInput])
#
# # filter()筛选功能,用到函数一定要返回True，函数里边可以用not 或者非note来判断正向筛选还是反向筛选
# def name(n):
#     if n.startswith('刘'):
#         return True
#
#
# print(list(filter(name, ['张三', '刘梦', '李达'])))
#
#
# # map()映射方法, map和filter输出都需要用list序列化出来结果集
# def add(i):
#     return 10 // i
#
#
# print(list(map(add, [23, 2, 1, 4, 2])))
#
#
# # 获取list索引位置
# def ls():
#     lst1 = [23, 542, 54, 2, 3556, 43]
#     return "list的索引位置index：", lst1.index(3556)
#
#
# print(ls())
#
#
# # 判断字符串中大写的几个，小写的几个
# def dXx():
#     s = "NSAJCJNDnjdnasjdnajD"
#     a = 0
#     b = 0
#     for i in s:
#         if i.islower():
#             a = a + 1
#         else:
#             b = b + 1
#     return a, b
#
#
# print(dXx())
#
#
# # 修改元组内部元素不可修改
# def modifyTuple():
#     t = (1, 2, 3, 4, [34, 56, "卧槽！", "希望是好的！"])
#     t[4].extend([1, 1, 2, 2, 3, 4, 5])
#     print(t)
#
#
# print(modifyTuple())
#
#
# # 列表推导式
# def l1():
#     l1 = [i for i in range(10)]
#     return l1
#
#
# print(l1())
#
#
# # 集合推导式
# def sett():
#     s1 = {i for i in range(10)}
#     return s1
#
#
# print(sett())
#
#
# # 字典推导式
# def dic():
#     l = ["性别", "姓名", "年龄", "籍贯"]
#     d = {i: l[i] for i in range(len(l))}
#     return d
#
#
# print(dic())
#
#
# # 函数嵌套
# def wapper(name):
#     s = 1
#
#     def inner(*args, **kwargs):
#         s = 2
#         print("inner函数被执行！")
#         iis = name(*args, **kwargs)
#         return iis
#
#     return inner
#
#
# @wapper
# def mbfunc(*args, **kwargs):
#     print("目标函数被执行")
#
#
# # *args 位置参数，元组形式，**kwargs关键字参数 k=v 格式，字典类型
# mbfunc()
#
#
# # 迭代器
# def ddq():
#     list = [1, 2, 3, 4, 5]
#     dict = {"a": 1, "b": 2, "c": 3}
#     set = {1, 2, 3, 4, 5}
#     tuple = (1, 2, 3, 4, 55)
#     str = "12312"
#     l1 = list.__iter__()
#     d1 = dict.__iter__()
#     print(l1.__next__())
#     print(l1.__next__())
#     print(l1.__next__())
#     print(d1.__next__())
#     print(d1.__next__())
#     print(d1.__next__())
#
#
# ddq()
#
#
# # 生成器,结合yield语法，返回一个可迭代对象，
# def yid(i):
#     i += 5
#     print("i:", i)
#     i = yield i
#     i = i ** 3
#     yield i
#
#
# y = yid(5)
# print("第一个调用", y.__next__())
# print(y.send(6))  # 传参必须有变量接收
# # print("第二个调用", y.__next__())
#

# 装饰器
def wapper(name):
    i = 36

    def inner(*args, **kwargs):
        print("inner运行了", i)
        iiFunc = name(*args, **kwargs)
        print("这是inner调用目标函数返回的结果！", iiFunc)
        print(args, kwargs)
        return iiFunc

    return inner


@wapper  # game = wapper(game)
def game(user, password):
    print("游戏开始了！", user, password)
    return "运行了游戏，返回点什么！"


print(game(user="周抗抗", password="123456"))
